﻿<%@ WebHandler Language="C#" Class="CheckDay" %>

using System;
using System.Web;
using System.Web.SessionState;
using System.Data;

public class CheckDay : IHttpHandler, IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        if (context.Session["user"] != null)
        {
            Json u = context.Session["user"].ToString();
            string openid = u["openid"];
            DataTable dt = DBHelper.GetDataTable(string.Format("select * from temple_days where openid = '{0}' and state = 1 and DateDiff(dd,addtime,getdate()) = 0", openid));
            if (dt != null && dt.Rows.Count > 0)
                context.Response.Write(0);
            else
                context.Response.Write(1);
        }
    }

    public bool IsReusable
    {
        get { return false; }
    }

}